package 蓝桥真题;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class 承压计算 {
	   static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
       static double a[][]=new double[100][100];
       static int n=1;
       public static void main(String[] args) throws IOException {
		      String[]ss=null;
		      while(!"X".equals((ss=br.readLine().split(" "))[0])){
		    	    for(int i=1;i<=n;i++)
		    	    	a[n][i]=Double.parseDouble(ss[i-1]);
		    	    n++;
		      }
		      n--;
		      for(int i=1;i<=n+1;i++){
		    	  for(int j=1;j<=i;j++){
		    		  a[i][j]+=a[i-1][j]/2;
		    		  a[i][j]+=a[i-1][j-1]/2;
		    	  }
		      }
		      double min=Integer.MAX_VALUE,max=Integer.MIN_VALUE;
		      for(int i=1;i<=30;i++){
		    	  max=Math.max(max,a[n+1][i]);
		    	  min=Math.min(min, a[n+1][i]);
		      }
		      System.out.print(max+" "+min);
		      System.out.print(72665192664L);
	}
}
 